# Dir Rules
OBJDIRS += lib

# extra includes and flags
LIB_CFLAGS	:= -nostdinc

# all sources
LIB_SRC :=	lib/string.c	\
		lib/entry.S	\
		lib/libmain.c	\
		lib/pool.c

# sources -> object files
LIB_OBJ :=	$(patsubst %.c, $(OBJDIR)/%.o, $(LIB_SRC))
LIB_OBJ :=	$(patsubst %.S, $(OBJDIR)/%.o, $(LIB_SRC))

SRCS 	+= $(LIB_SRC)

# targets for all .c files
$(OBJDIR)/lib/%.o: lib/%.c
	@mkdir -p $(@D)
	$(CC) $(CFLAGS) $(LIB_CFLAGS) -I$(INC) -c -o $@ $<

$(OBJDIR)/lib/%.o: lib/%.S
	@mkdir -p $(@D)
	$(CC) $(CFLAGS) $(LIB_CFLAGS) -I$(INC) -c -o $@ $<

